package dockerfile

import (
	"context"

	"docker/internal/svc"
	"docker/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type DockerfileDelLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewDockerfileDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DockerfileDelLogic {
	return &DockerfileDelLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *DockerfileDelLogic) DockerfileDel(req *types.DockerfileStageDelReq) (resp *types.BooleanResp, err error) {
	_, err = l.svcCtx.DockerfileModel.Delete(l.ctx, req.Id)
	return &types.BooleanResp{
		Result: types.Result{
			Code:      200,
			Message:   "",
			ExtInfo:   "",
			Timestamp: 0,
		},
		Data: err == nil,
	}, err
}
